{{--/**
 * Created by PhpStrom
 * User: 郭碧云
 * Date: 2021/3/30 10:46
 * Desc:
 */--}}
<form id="org_edit" style="margin-top: 15px;" class="layui-form" action="{{route('admin.org.update',["id"=>$org["id"]])}}">
    {{csrf_field()}}
    <div class="layui-form-item">
        <label class="layui-form-label">上级机构</label>
        <div class="layui-input-block">
{{--            <x-org-select :select="$org['parent_id']" :name="'data[parent_id]'" :width="'60%'"/>--}}
            <div id="parent_id" style="width: 60%"></div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" id="name" name="data[name]" autocomplete="off" placeholder="请输入机构名称" value="{{$org["name"]}}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="number" id="sort" name="data[sort]" autocomplete="off" placeholder="请输入排列顺序" value="{{$org["sort"]}}"
                   class="layui-input" min="0" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v();">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea type="text" id="description" name="data[description]" autocomplete="off" placeholder="机构说明"
                      class="layui-input">{{$org["description"]}}</textarea>
        </div>
    </div>
</form>
<script src="{{asset('layui/modules/xm-select.js')}}"></script>
<script src="{{asset('js/tree/select.js')}}"></script>
<script>
    layui.use(['xmSelect'], function () {
        var xmSelect=layui.xmSelect;
        let params=selectTreeParams('#parent_id','data[parent_id]','请选择',"{{$org['parent_id']}}",JSON.parse('{!! $orgs !!}'),(res)=>{});
        xmSelect.render(params)
    });
</script>

